package demo6;

import java.awt.image.FilteredImageSource;
import java.io.IOException;
import java.util.Scanner;

class NameException extends RuntimeException {
    public NameException() {
        super();
    }

    public NameException(String message) {
        super(message);
    }
}
public class Test {
    public static void main(String[] args){
        try(Scanner scanner = new Scanner(System.in)) {
            int[] array = null;
            System.out.println(array.length);
            int a = 10 / 0;
            System.out.println("after");
        }catch (ArithmeticException e) {
            e.printStackTrace();
            System.out.println("捕捉到了 ArithmeticException 异常!!!!");
        } catch (NullPointerException c) {
            System.out.println("捕捉到了  NullPointerException  异常");
        } finally {
            //一般用来对资源的释放
            System.out.println("不管try中是否会抛出异常,finally里的语句终将会执行!!");
        }
        System.out.println("之后的代码!!");
        System.out.println("就可以继续打印了");
    }
}
